(function () {
    window.sout = function (val) {
        console.info(val)
    };


    /**
     * 这个AttachmentItem的主要功能在于将之前的AttachmentList进行拆散，主要的作用是
     * List->Item ,对应每一个List 进行的操作是addItems进行操作。从而方便对Items的管理
     * 并且我们可以直接获取到AttachmentItem对象，从而对Item 的实际样式进行操作等一些列具体的
     * 方案
     *
     * How can we fetch AttachmentItem through EntityId,
     * by default ,we store AttachmentItem inside a json cache map
     * with entityId->AttachmentItem
     * when we need to update some of the property of this item ,
     * we just need to operate it like this
     *
     *        ai.updateTitle('newTitle.doc');
     *
     * Inside updateTitle method ,we fetch dom by getDom() method easily ,
     * and we get a jquery object
     *
     * then the core function do something on it ,which change the data of html block
     *
     * this is just thinking ,wait to be update and recode.
     *
     */
    dorado.widget.AttachmentItem=$class({
        ATTRIBUTES:{
            $className: "dorado.widget.AttachmentItem",
            data:{}//entity
        },
        //裸dom
        _rawdom:undefined,
        //实际dom
        _dom:undefined,
        constructor: function () {
            this._rawdom=this.crateDom();
            //进行赋值的操作
            $invokeSuper.call(this, arguments);
        },
        EVENTS:{
        },
        getDom:function(){
            return this._dom;
        },
        locatedResource:function(){
            var $dom=$(this._rawdom);
            var $title=$dom.find('.m-attachment');
            var $download=$dom.find('.m-links>:first');
            var $remove=$dom.find('.m-links>:last');
            var $attchsize=$dom.find('.attchsize');
            var $succ=$dom.find('.f-txt-succ');
            var $blocking=$dom.find('.f-txt-blocking');
            var $err=$dom.find('.f-txt-err');
        },
        updateTitle:function (val) {
            var $dom=$(this._dom);
            var $title=$dom.find('.m-attachment');
            var $attachname=$dom.find('.attachname');
            var $icon=$dom.find('.attchtrumb');
            //TODO待开发
        }
        ,
        //用于初始化创建一个dom ,这个dom 的作用是可以进行操作
        crateDom:function(){
            var self=this;
            return $DomUtils.xCreate(
                { tagName: "div", className: 'fj-div-info',
                    //find('m-attachment').attr('title','what')
                    content: [{ tagName: "div", className: "m-attachment", title:'',
                        content:[{ tagName: "div", className: "wrapper",
                            content: [
                                { tagName: "div", className: "action",
                                    content: [
                                        {tagName: 'div', className: 'm-links', content: [
                                            //find('m-links:first');
                                            { tagName: 'span', className: 'link', title: '下载', content: '下载',
                                                onclick: function () {

                                                }},
                                            //find('m-links:last');
                                            { tagName: 'span', className: 'link', title: '删除', content: '删除',
                                                onclick: function () {

                                                } } ] } ]
                                }, //定位表达式 find('attchtrumb')
                                { tagName: "div", className: "attchtrumb w-icon-attach-m "
                                }, { tagName: "div", className: "attch",
                                    content: [
                                        { tagName: 'div', className: 'attchinfo', content: [
                                            //定位表达式 find('.attachname').text()
                                            {tagName: 'span', className: 'attchname'},
                                            //定位表达式 find('.attchsize').text()
                                            {tagName: 'span', className: 'attchsize'}
                                        ] }, {
                                            tagName: 'div', className: 'attchstatus', content: [
                                                //定位表达式 find('.attachstatus>.f-txt-succ');
                                                {tagName: 'span', className: 'f-txt-succ', content: '上传成功',style:'display:none;'},
                                                //定位表达式 find('.attachstatus>.f-txt-blocking');
                                                {tagName: 'span', className: 'f-txt-blocking', content: '上传中...',style:'display:none;'},
                                                //定位表达式 find('.attachstatus>.f-txt-err');
                                                {tagName: 'span', className: 'f-txt-err', content: '上传失败',style:'display:none;'}
                                            ] }
                                    ]
                                }
                            ]
                        }]
                    }
                    ]
                }
            );
        }

    });
    dorado.widget.AttachmentList = $extend([dorado.widget.Control,dorado.widget.DataControl], {
        ATTRIBUTES:{
            $className: "dorado.widget.AttachmentList",
            titleProperty:{
                defaultValue:'title'
            },
            showSize:{
                defaultValue:true
            },
            sizeProperty:{
                defaultValue:'size'
            },
            showProgress:{
                defaultValue:false
            },
            progressProperty:{
                defaultValue:'progress'
            },
            showStatus:{
                defaultValue:true
            },
            statusProperty:{
                defaultValue:'status'
            },itemModel:{}

        },
        EVENTS: {
            onItemDownload: {},
            onItemRemove: {},
            onItemInsert: {},
            beforeRenderItem: {},
            beforeItemDelete: {},
            afterItemDelete: {}
        }
        /*,
        resetDimension: function() {
            var el = $fly(this.getDom()), changed = false;
            var width = this.getRealWidth();
            debugger;
            sout('RealWidth'+width);
            var height = this.getRealHeight();
            sout("RealHeight"+height);
            if (width && this._currentWidth != width) {
                this._currentWidth = width;
                el.outerWidth(width);
                changed = true;
            }
            if (height && this._currentHeight != height) {
                this._currentHeight = height;
                el.outerHeight(height);
                changed = true;
            }
            return changed;
        }*/
        ,
        constructor: function () {
            //
            $invokeSuper.call(this, arguments);
        },
        //是否已经初始化
        _init:false,
        _itemDomMap:{},
        _allDomMap:{},
        _currentObjId:undefined,
        _currentDomMap:{},
        createDom: function (self, arg) {
            var widget = this, doms = {},dom = $DomUtils.xCreate({tagName: "div", className: ['fj-container'], content: []}, null, doms);
            if(this._width){
                dom.style.width=this._width;
            }
            if(this._height){
                dom.style.height=this._height;
            }
            widget._doms = doms;
            return dom;
        },
        /**
         * 根据Entity进行初始化并且将所有的控件放置到self中
         * @param arg
         */
        initItems:function(arg){
            var self=this;
            var el=arg.entityList;
            if(this._currentObjId!==el.objId){
                $(arg.dom).empty();
                this._currentObjId=el.objId;
                if(el){
                    var domMap={};
                    el.each(function (entity) {
                        domMap[entity.entityId]=self.createItem({
                            dom: arg.dom,
                            data: entity
                        });
                    });
                    this._currentDomMap=domMap;
                }
            }
        },
        /**
         * 插入一个项目之后执行的代码
         */
        insertItem:function(arg) {
            //将新插入 的entity注入domMap
            var insertedEntityDataType=arg.entity.dataType;
            var entityList=this.getBindingData();
            if(entityList){
                var elDT=entityList.dataType;
                var flag=false;
                entityList.each(function(entity){
                    if(entity.entityId==arg.entity.entityId){
                        flag=true;
                    }
                });
                if(elDT&&flag){
                    var dataType = entityList.dataType.getElementDataType("auto");
                    if(insertedEntityDataType==dataType){
                        this._currentDomMap[arg.entity.entityId]=this.createItem({
                            dom: this.getDom(),
                            data: arg.entity
                        });
                        this.fireEvent('onItemInsert',this,arg);
                    }
                }
            }

        },
        createItem:function(arg){
            var $div=this.createBlock(arg);
            $(arg.dom).append($div);
            return $div;
        },
        /**
         * 接受到删除消息的时候，执行的
         */
        removeItem:function(arg){
            if(arg.entity){
                var entity=arg.entity;
                //是否从当前map中进行操作就没有错吗啊
                var $div=this._currentDomMap[entity.entityId];
                if($div){
                    $div.remove();
                    this.fireEvent("onItemRemove",this,arg);
                }
            }
        },
        refreshItem:function(arg){
            //这个refreshItem 忘记了进行子属性的刷新操作
            if(arg.entity) {

                //新增一个属性前缀，这个的作用是可以通过迭代查询的方式进行子属性的递归获取
                var propPrefix="";
                var $div=this._currentDomMap[arg.entity.entityId];
                //如果是没有找到的情况下，应该怎么办？
                //整个执行刷新
                if(!$div){
                    var arr=[];
                    $div=this.recusiveDomMap(this._currentDomMap,arg.entity,arr);
                    if($div){
                        var temp;
                        while((temp=arr.pop())){
                            propPrefix+=temp+".";
                        }
                    }
                }


                if($div){
                    //如果符合任意一个更新项目
                    var json=arg.entity.toJSON();
                    var titleProperty=this.get('titleProperty');
                    titleProperty=propPrefix+titleProperty;
                    var showSize=this.get('showSize');
                    var sizeProperty=this.get('sizeProperty');
                    sizeProperty=propPrefix+sizeProperty;
                    var showProgress=this.get('showProgress');
                    var progressProperty=this.get('progressProperty');
                    progressProperty=propPrefix+progressProperty;
                    var statusProperty=this.get('statusProperty');
                    statusProperty=propPrefix+statusProperty;
                    var showStatus=this.get('showStatus');
                    var title=$div.find('.m-attachment');
                    var name=$div.find('.attchname');
                    var icon=$div.find('.attchtrumb');
                    icon.attr("class","attchtrumb w-icon-attach-m "+dorado.widget.AttachmentUtils.getIcoClass(this.jsonReader(json,titleProperty)));
                    title.attr('title',json[titleProperty]);
                    name.text(this.jsonReader(json,titleProperty));
                    var size=$div.find('.attchsize');
                    var sizeVal=this.jsonReader(json,sizeProperty);
                    if(showSize&&sizeVal){
                        size.text("("+dorado.widget.AttachmentUtils.bytesToSize(sizeVal)+")");
                    }
                    var download=$div.find('.link:first');
                    var status=$div.find('.attchstatus>span:first');
                    var progress=$div.find('.attchstatus>.f-txt-progress');
                    if(showStatus){
                        switch (this.jsonReader(json,statusProperty)){
                            case 1:
                                status.attr('class',"f-txt-err");
                                status.text("上传失败");
                                download.css('display','none');
                                progress.css('display','none');
                                break;
                            case 0:
                                status.attr('class',"f-txt-blocking");
                                //判断是否
                                status.text("上传中...");
                                if(showProgress){
                                    progress.css('display','');
                                    progress.text(this.jsonReader(json,progressProperty));
                                }else{
                                    progress.css('display','none');
                                }
                                download.css('display','none');
                                break;
                            default:
                                download.css('display','');
                                progress.css('display','none');
                                status.attr('class',"f-txt-succ");
                                status.text("上传完成");
                                break;
                        }
                    }else{
                        download.css('display','');
                        progress.css('display','none');
                        status.attr('class',"f-txt-succ");
                        status.text("上传完成");
                    }
                }
            }
        },
        recusiveDomMap:function(domMap,entity,arr){
            var $div=domMap[entity.entityId];
            if($div){
                return $div;
            }else {
                var parent=entity.parent;
                var parentProperty=entity.parentProperty;
                if(parent){
                    if(parentProperty){
                        arr.push(parentProperty);
                    }
                    return this.recusiveDomMap(domMap,parent,arr);
                }else{
                    return ;
                }
            }
        },
        updateItem:function(arg){
            if(arg.entity){
                var prop="";
                var json=arg.entity.toJSON();
                //万一更新的是子对象属性呢？
                var $div=this._currentDomMap[arg.entity.entityId];
                if(!$div){
                    var arr=[];
                    $div=this.recusiveDomMap(this._currentDomMap,arg.entity,arr);
                    if($div){
                        var temp;
                        while((temp=arr.pop())){
                            prop+=temp+".";
                        }
                    }
                }
                //如果有，才会执行更新，否则则不执行更新
                if($div){
                    //如果执行更新的是字符串的话
                    prop+=arg['property'];
                    var newValue=arg['newValue'];
                    var oldValue=arg['oldValue'];
                    if(newValue!==oldValue){

                        //如果符合任意一个更新项目
                        var titleProperty=this.get('titleProperty');
                        var showSize=this.get('showSize');
                        var sizeProperty=this.get('sizeProperty');
                        var showProgress=this.get('showProgress');
                        var progressProperty=this.get('progressProperty');
                        var statusProperty=this.get('statusProperty');
                        var showStatus=this.get('showStatus');
                        //标题
                            if(prop===titleProperty){
                                var title=$div.find('.m-attachment');
                                var name=$div.find('.attchname');
                                var icon=$div.find('.attchtrumb');
                                icon.attr("class","attchtrumb w-icon-attach-m "+dorado.widget.AttachmentUtils.getIcoClass(newValue));
                                title.attr('title',newValue);
                                name.text(newValue);
                            }else if(prop===sizeProperty){
                                var size=$div.find('.attchsize');
                                size.text("("+dorado.widget.AttachmentUtils.bytesToSize(newValue)+")");
                            }else if(prop===statusProperty){
                                var progress=$div.find('.attchstatus>.f-txt-progress');
                                if(showStatus){
                                    var download=$div.find('.link:first');
                                    var status=$div.find('.attchstatus>span:first');
                                    switch (json[statusProperty]){
                                        case 1:
                                            status.attr('class',"f-txt-err");
                                            status.text("上传失败");
                                            download.css('display','none');
                                            progress.css('display','none');
                                            break;
                                        case 0:
                                            status.attr('class',"f-txt-blocking");
                                            //判断是否
                                            status.text("上传中...");
                                            if(showProgress){
                                                progress.css('display','');
                                                progress.text(json[progressProperty])
                                            }else{
                                                progress.css('display','none');
                                            }
                                            download.css('display','none');
                                            break;
                                        default:
                                            progress.css('display','none');
                                            status.attr('class',"f-txt-succ");
                                            status.text("上传完成");
                                            download.css('display','');
                                            break;
                                    }
                                }else{
                                    download.css('display','');
                                    progress.css('display','none');
                                    status.attr('class',"f-txt-succ");
                                    status.text("上传完成");
                                }
                            }else if(prop===progressProperty){
                                progress=$div.find('.attchstatus>.f-txt-progress');
                                progress.text(newValue);

                            }
                            $div._data.toJSON();
                    }
                }

            }
        },
        /**
         * 根据数据进行加载
         * @param dom 被渲染的主控件
         * @returns {boolean}
         */
        refreshDom: function (dom) {
            //刷新dom的方法在
            if(this._dataSet){
                var entityList = this.getBindingData();

                /**
                 * 可以每一次都进行列表的刷新吗？浪费性能
                 */
                if(entityList){
                    if (!(entityList instanceof dorado.EntityList)) {
                        throw new dorado.ResourceException("dorado.grid.BindingTypeMismatch", (this._id || this._uniqueId));
                    }else{
                        //执行初始化
                        this.initItems({
                            entityList:entityList,
                            dom:dom
                        })
                    }
                }

                $invokeSuper.call(this, arguments);
            }
            return true;
        },
        /**
         * 对接收到的消息进行过滤
         * @param messageCode
         * @param arg
         * @param data
         * @returns {boolean}
         */
        filterDataSetMessage: function(messageCode, arg, data){
            return true;
        },
        processDataSetMessage: function(messageCode, arg, data){
            switch (messageCode) {
                //通知监听器需要进行数据刷新,也就是调用dataSet.refresh的方法执行刷新
                case dorado.widget.DataSet.MESSAGE_REFRESH:
                    this.refresh(true);
                    break;
                case dorado.widget.DataSet.MESSAGE_CURRENT_CHANGED:
                     this.refresh(true);
                    break;
                case dorado.widget.DataSet.MESSAGE_DATA_CHANGED:
                    this.updateItem(arg);
                    break;
                case dorado.widget.DataSet.MESSAGE_REFRESH_ENTITY:
                  this.refreshItem(arg);
                    break;
                case dorado.widget.DataSet.MESSAGE_ENTITY_STATE_CHANGED:
                    break;
                case dorado.widget.DataSet.MESSAGE_DELETED:
                    this.removeItem(arg);
                    break;
                case dorado.widget.DataSet.MESSAGE_INSERTED:
                    this.insertItem(arg);
                    break;
                case dorado.widget.DataSet.MESSAGE_LOADING_START:
                    break;
                case dorado.widget.DataSet.MESSAGE_LOADING_END:
                    this.refresh(true);
                    break;
                default:

                    break;
            }
        },
        /**
         * 使用Entity 的方式生成Block
         * @param entity
         * @returns {*}
         */
        buildBlock:function(entity){
            return this.generateBlock({data:entity});
        },
        jsonReader:function (obj,prop) {
            if(obj&&prop){
                var arr=prop.split('.');
                var temp=obj;
                arr.each(function (one) {
                    if(temp instanceof dorado.Entity){
                        if(temp){
                            temp=temp.get(one);
                        }else{
                            return "";
                        }
                    }
                    else{
                        if(temp){
                            temp=temp[one];
                        }else{
                            return "";
                        }
                    }
                });
                return temp;
            }
        },
        /**
         * 根据送入的json串生成dom 元素
         * json串必须包含如下属性
         *  title 文件名
         *  size 文件大小
         *  status 状态如果成功 0 上传中 1 失败 2成功
         *  progress 进度 0%~100% 进度一共有100个百分比的进度可以使用
         * @returns {*|jQuery|HTMLElement}
         * @param arg
         */
        createBlock:function(arg){
            var self=this;
            var entity=arg.data;
            var $div=$('<div>');
            $div._data=entity;

            arg['_dom']=$div[0];
            arg['processDefault']=true;

            this.fireEvent('beforeRenderItem',this,arg);
            /**
             * 默认的生成区块的代码
             */
            if(arg.processDefault){
                var json=entity.toJSON();
                $div.addClass("fj-div-info");
                var $div_c1=$('<div>');
                $div_c1.addClass("m-attachment");
                var titleProperty=this.get('titleProperty');
                $div_c1.attr('title',this.jsonReader(json,titleProperty));
                var $c1_wrapper=$('<div>');
                $c1_wrapper.addClass("wrapper");
                var $wrapper_action=$('<div>');
                $wrapper_action.addClass("action");
                var $action_link=$('<div>');
                $action_link.addClass("m-links");
                var $link_download=$('<span>');
                $link_download.addClass('link');
                $link_download.attr({
                    title:'下载'
                });
                $link_download.click(function () {
                    self.fireEvent('onItemDownload',self,arg);
                });
                $link_download.text('下载');
                $action_link.append($link_download);
                var $link_del=$('<span>');
                $link_del[0].onclick=function () {
                };
                $link_del.addClass('link');
                $link_del.attr({
                    title:'删除'
                });
                $link_del.click(function () {
                    self.fireEvent('beforeItemDelete',self,arg);
                    dorado.MessageBox.confirm('确定要删除?',function () {
                        entity.remove();
                        self.fireEvent('afterItemDelete',self,arg);
                    });
                });
                $link_del.text('删除');
                $action_link.append($link_del);
                $wrapper_action.append($action_link);

                var $wrapper_icon=$('<div>');
                $wrapper_icon.addClass("attchtrumb w-icon-attach-m "+dorado.widget.AttachmentUtils.getIcoClass(this.jsonReader(json,titleProperty)));
                var $wrapper_attach=$('<div>');
                $wrapper_attach.addClass("attch");
                var $attach_info=$('<div>');
                $attach_info.addClass('attchinfo');

                var $info_name=$('<span>');
                $info_name.addClass('attchname');
                $info_name.text(this.jsonReader(json,titleProperty));

                var $info_size=$('<span>');
                $info_size.addClass('attchsize');
                var showSize=this.get('showSize');
                if(showSize){
                    var sizeProperty=this.get('sizeProperty');
                    //如果大小为空，那么久不显示
                    if(this.jsonReader(json,sizeProperty)){
                        $info_size.text("("+dorado.widget.AttachmentUtils.bytesToSize(this.jsonReader(json,sizeProperty))+")");
                    }
                }

                $attach_info.append($info_name);
                $attach_info.append($info_size);

                var $attach_status=$('<div>');
                $attach_status.addClass('attchstatus');
                var $status_txt=$('<span>');
                var $progress_txt=$('<span>');

                $progress_txt.attr('class',"f-txt-progress");



                /**
                 * 默认是上传中...吗？
                 * 不，是默认上传成功!
                 */
                var statusProperty=this.get('statusProperty');
                var showStatus=this.get('showStatus');
                if(showStatus){
                    var prop=this.jsonReader(json,statusProperty);
                    switch (prop){
                        case 1:
                            $status_txt.attr('class',"f-txt-err");
                            $status_txt.text("上传失败");
                            $progress_txt.css('display','none');
                            //如果是上传失败，那么久不能显示下载链接
                            $link_download.css('display','none');
                            break;
                        case 0:
                            $status_txt.attr('class',"f-txt-blocking");
                            //判断是否
                            var progressProperty=this.get('progressProperty');
                            var showProgress=this.get('showProgress');
                            if(showProgress){
                                $progress_txt.text(this.jsonReader(json,progressProperty));
                                $status_txt.text("上传中...");
                            }else{
                                $progress_txt.css('display','none');
                                $status_txt.text("上传中...");
                            }
                            $link_download.css('display','none');
                            break;
                        default:
                            $status_txt.attr('class',"f-txt-succ");
                            $status_txt.text("上传完成");
                            $progress_txt.css('display','none');
                            break;
                    }

                }else{
                    $status_txt.addClass("f-txt-succ");
                    $status_txt.text('上传成功');
                    $progress_txt.css('display','none');
                }

                $attach_status.append($status_txt);
                $attach_status.append($progress_txt);

                $wrapper_attach.append($attach_info);
                $wrapper_attach.append($attach_status);

                $c1_wrapper.append($wrapper_action);
                $c1_wrapper.append($wrapper_icon);
                $c1_wrapper.append($wrapper_attach);
                $div_c1.append($c1_wrapper);
                $div.append($div_c1);

            }

            return $div;
        }
    });

    /**
     * 这个工具集合有一部分的功能方法供我们使用
     */
    dorado.widget.AttachmentUtils={
        getIcoClass:function (fileName) {
            return "ico-"+this.recognizeMappedType(fileName)+"-m";
        },
        bytesToSize : function(bytes) {
            if (bytes === 0)
                return '0 B';
            var k = 1024;
            var sizes = [ 'B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ];
            var i = Math.floor(Math.log(bytes) / Math.log(k));
            return Math.floor((bytes / Math.pow(k, i))) + ' ' + sizes[i];
        },
        /**
         * 输入一个文件名，识别出这个文件名的所属css类
         * @param fileName 可以是文件名，也可以是后缀
         * @returns {*}
         */
        recognizeMappedType:function (fileName) {
            if(undefined!==fileName&&null!==fileName&&fileName.length!==0){
                var idx=fileName.lastIndexOf('.');
                var rst;
                if(idx!==-1){
                    var suffix=fileName.substr(idx+1,fileName.length);
                    if(suffix){
                        rst=this.typeMapper[suffix];
                        if(rst){
                            return rst;
                        }else{
                            return this.typeMapper.other;
                        }
                    }else{
                        return this.typeMapper.other;
                    }
                }else{
                    rst=this.typeMapper[fileName];
                    if(rst){
                        return rst;
                    }else{
                        return this.typeMapper.other;
                    }
                }
            }else{
                return this.typeMapper.other;
            }
        },
        typeMapper:{
            "other":"other",
            "xls":"xls",
            "xlsx":"xlsx",
            "csv":"csv",
            "doc":"doc",
            "docx":"docx",
            "wps":"wps",
            "ppt":"ppt",
            "pptx":"pptx",
            "7z":"7z",
            "rar":"rar",
            "cab":"cab",
            "jar":"jar",
            "arj":"arj",
            "tar":"tar",
            "gz":"gz",
            "tgz":"tgz",
            "zip":"zip",
            "iso":"iso",
            "img":"img",
            "nrg":"nrg",
            "mdf":"mdf",
            "mds":"mds",
            "eml":"eml",
            "htm":"htm",
            "html":"html",
            "shtml":"shtml",
            "xhtml":"xhtml",
            "mht":"mht",
            "asp":"asp",
            "aspx":"aspx",
            "js":"js",
            "css":"css",
            "ini":"ini",
            "inf":"inf",
            "xml":"xml",
            "hlp":"hlp",
            "chm":"chm",
            "exe":"exe",
            "app":"app",
            "com":"com",
            "bat":"bat",
            "cmd":"cmd",
            "ttf":"ttf",
            "fon":"fon",
            "pdf":"pdf",
            "psd":"psd",
            "pdd":"pdd",
            "ps":"ps",
            "ai":"ai",
            "eps":"eps",
            "fla":"fla",
            "swf":"swf",
            "flv":"flv",
            "txt":"txt",
            "rtf":"rtf",
            "reg":"reg",
            "ra":"ra",
            "ram":"ram",
            "rpm":"rpm",
            "rmx":"rmx",
            "rm":"rm",
            "rmvb":"rmvb",
            "wm":"wm",
            "wma":"wma",
            "wmv":"wmv",
            "asf":"asf",
            "wmp":"wmp",
            "mov":"mov",
            "qt":"qt",
            "3gp":"3gp",
            "3gpp":"3gpp",
            "amr":"amr",
            "avi":"avi",
            "mkv":"mkv",
            "mp4":"mp4",
            "mpg":"mpg",
            "mpeg":"mpeg",
            "vob":"vob",
            "dat":"dat",
            "ts":"ts",
            "tp":"tp",
            "m2ts":"m2ts",
            "evo":"evo",
            "pmp":"pmp",
            "vp6":"vp6",
            "ivf":"ivf",
            "dsm":"dsm",
            "dsv":"dsv",
            "dsa":"dsa",
            "dss":"dss",
            "fli":"fli",
            "flc":"flc",
            "flic":"flic",
            "roq":"roq",
            "mpa":"mpa",
            "m1a":"m1a",
            "m2a":"m2a",
            "mp2":"mp2",
            "mp3":"mp3",
            "ac3":"ac3",
            "dts":"dts",
            "ddp":"ddp",
            "flac":"flac",
            "ape":"ape",
            "mac":"mac",
            "apl":"apl",
            "shn":"shn",
            "tta":"tta",
            "wv":"wv",
            "cda":"cda",
            "wav":"wav",
            "aac":"aac",
            "m4a":"m4a",
            "mka":"mka",
            "ogg":"ogg",
            "mpc":"mpc",
            "mp":"mp",
            "mpp":"mpp",
            "au":"au",
            "aif":"aif",
            "aifc":"aifc",
            "aiff":"aiff",
            "mid":"mid",
            "midi":"midi",
            "rmi":"rmi",
            "jpg":"jpg",
            "jpeg":"jpeg",
            "gif":"gif",
            "png":"png",
            "bmp":"bmp",
            "dib":"dib",
            "rle":"rle",
            "tif":"tif",
            "tiff":"tiff",
            "xif":"xif",
            "emf":"emf",
            "wmf":"wmf",
            "icl":"icl",
            "cur":"cur",
            "ani":"ani",
            "raw":"raw",
            "dll":"dll",
            "manifest":"manifest",
            "bin":"bin",
            "torrent":"torrent",
            "bt":"torrent",
            "apk":"zip",
            "sql":"txt"
        }
    };

})();